package io.dshubs.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.dshubs.commons.security.user.SecurityUser;
import io.dshubs.commons.tools.utils.Result;
import io.dshubs.dao.SysFuncDao;
import io.dshubs.dto.SysDeptDTO;
import io.dshubs.entity.SysFuncEntity;
import io.dshubs.service.SysFuncService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

/**
 * <p>
 * 首页功能表 前端控制器
 * </p>
 *
 * @author tan
 * @since 2021-09-02
 */
@RestController
@RequestMapping("/sys-func")
public class SysFuncController {

    @Autowired
    private SysFuncDao sysFuncDao;

    @GetMapping("list")
    @ApiOperation("列表")
    public Result<List<SysFuncEntity>> list(){
        List<SysFuncEntity> list = sysFuncDao.selectList(new QueryWrapper<
                SysFuncEntity>().eq("user_id", SecurityUser.getUserId())
                .eq("del_flag","0").orderByDesc("count").last("limit 0,10"));


        return new Result<List<SysFuncEntity>>().ok(list);
    }

}
